<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   支持向量机在 R 语言中的实现和使用  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/12490.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466460972: Accept with keywords: (title(0.25):社区,语言,向量,数盟, topn(0.533333333333):社区,机是,维空间,数盟,分类器,行业资讯,数据挖掘,径向,数据分析,边界,结果,人工智能,模型,职业规划,参数,文章,基础架构,数据,向量,函数,网格,问题,超平面,可视化,线性,类别,编程语言,分类,内核,变量).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    支持向量机在 R 语言中的实现和使用
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    支持向量机在 R 语言中的实现和使用 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,65] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/ai">
       人工智能
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/12490.html">
          支持向量机在 R 语言中的实现和使用
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,967 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/ai" rel="category tag">
          人工智能
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        支持向量机是一个相对较新和较先进的机器学习技术，最初提出是为了解决二类分类问题，现在被广泛用于解决多类非线性分类问题和回归问题。继续阅读本文，你将学习到支持向量机如何工作，以及如何利用R语言实现支持向量机。
       </p>
       <h3>
        支持向量机如何工作？
       </h3>
       <p>
        简单介绍下支持向量机是做什么的：
       </p>
       <p>
        假设你的数据点分为两类，支持向量机试图寻找最优的一条线（超平面），使得离这条线最近的点与其他类中的点的距离最大。有些时候，一个类的边界上的点可能越过超平面落在了错误的一边，或者和超平面重合，这种情况下，需要将这些点的权重降低，以减小它们的重要性。
       </p>
       <p>
        这种情况下，“支持向量”就是那些落在分离超平面边缘的数据点形成的线。
       </p>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/03/6941baebgw1epzadjhxlsj208c07v0tr1.jpg"/>
       </p>
       <h3>
        无法确定分类线（线性超平面）时该怎么办？
       </h3>
       <p>
        此时可以将数据点投影到一个高维空间，在高维空间中它们可能就变得线性可分了。它会将问题作为一个带约束的最优化问题来定义和解决，其目的是为了最大化两个类的边界之间的距离。
       </p>
       <h3>
        我的数据点多于两个类时该怎么办？
       </h3>
       <p>
        此时支持向量机仍将问题看做一个二元分类问题，但这次会有多个支持向量机用来两两区分每一个类，直到所有的类之间都有区别。
       </p>
       <h3>
        工程实例
       </h3>
       <p>
        让我们看一下如何使用支持向量机实现二元分类器，使用的数据是来自MASS包的cats数据集。在本例中你将尝试使用体重和心脏重量来预测一只猫的性别。我们拿数据集中20%的数据点，用于测试模型的准确性（在其余的80%的数据上建立模型）。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b29458ee940504441" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          # Setup
library(e1071)
data(cats, package="MASS")
inputData &amp;lt;- data.frame(cats[, c (2,3)], response = as.factor(cats$Sex)) # response as factor
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b29458ee940504441-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b29458ee940504441-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b29458ee940504441-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b29458ee940504441-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b29458ee940504441-1">
               <span class="crayon-p">
                # Setup
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b29458ee940504441-2">
               <span class="crayon-e">
                library
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                e1071
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b29458ee940504441-3">
               <span class="crayon-e">
                data
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cats
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-t">
                package
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "MASS"
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b29458ee940504441-4">
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                frame
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cats
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                c
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                as
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                factor
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cats
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                Sex
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # response as factor
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0116 seconds] -->
       <p>
       </p>
       <h3>
        线性支持向量机
       </h3>
       <p>
        传递给函数svm()的关键参数是kernel、cost和gamma。Kernel指的是支持向量机的类型，它可能是线性SVM、多项式SVM、径向SVM或Sigmoid SVM。Cost是违反约束时的成本函数，gamma是除线性SVM外其余所有SVM都使用的一个参数。还有一个类型参数，用于指定该模型是用于回归、分类还是异常检测。但是这个参数不需要显式地设置，因为支持向量机会基于响应变量的类别自动检测这个参数，响应变量的类别可能是一个因子或一个连续变量。所以对于分类问题，一定要把你的响应变量作为一个因子。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b29458ff649291215" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          # linear SVM
svmfit &amp;lt;- svm(response ~ ., data = inputData, kernel = "linear", cost = 10, scale = FALSE) # linear svm, scaling turned OFF
print(svmfit)
plot(svmfit, inputData)
compareTable &amp;lt;- table (inputData$response, predict(svmfit))  # tabulate
mean(inputData$response != predict(svmfit)) # 19.44% misclassification error
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b29458ff649291215-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b29458ff649291215-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b29458ff649291215-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b29458ff649291215-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b29458ff649291215-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b29458ff649291215-6">
               6
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b29458ff649291215-1">
               <span class="crayon-p">
                # linear SVM
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b29458ff649291215-2">
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                svm
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                ~
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                kernel
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "linear"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cost
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                scale
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-t">
                FALSE
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # linear svm, scaling turned OFF
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b29458ff649291215-3">
               <span class="crayon-e">
                print
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b29458ff649291215-4">
               <span class="crayon-e">
                plot
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b29458ff649291215-5">
               <span class="crayon-v">
                compareTable
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                table
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # tabulate
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b29458ff649291215-6">
               <span class="crayon-e">
                mean
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                !=
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # 19.44% misclassification error
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0217 seconds] -->
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/03/6941baebgw1epzadj4phtj208c05qgm3.jpg"/>
       </p>
       <h3>
        径向支持向量机
       </h3>
       <p>
        径向基函数作为一个受欢迎的内核函数，可以通过设置内核参数作为“radial”来使用。当使用一个带有“radial”的内核时，结果中的超平面就不需要是一个线性的了。通常定义一个弯曲的区域来界定类别之间的分隔，这也往往导致相同的训练数据，更高的准确度。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b294590a515904980" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          # radial SVM
svmfit &amp;lt;- svm(response ~ ., data = inputData, kernel = "radial", cost = 10, scale = FALSE) # radial svm, scaling turned OFF
print(svmfit)
plot(svmfit, inputData)
compareTable &amp;lt;- table (inputData$response, predict(svmfit))  # tabulate
mean(inputData$response != predict(svmfit)) # 18.75% misclassification error
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b294590a515904980-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294590a515904980-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b294590a515904980-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294590a515904980-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b294590a515904980-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294590a515904980-6">
               6
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b294590a515904980-1">
               <span class="crayon-p">
                # radial SVM
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294590a515904980-2">
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                svm
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                ~
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                kernel
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "radial"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cost
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                scale
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-t">
                FALSE
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # radial svm, scaling turned OFF
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294590a515904980-3">
               <span class="crayon-e">
                print
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294590a515904980-4">
               <span class="crayon-e">
                plot
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294590a515904980-5">
               <span class="crayon-v">
                compareTable
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                table
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # tabulate
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294590a515904980-6">
               <span class="crayon-e">
                mean
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                !=
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # 18.75% misclassification error
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0106 seconds] -->
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/03/6941baebgw1epzadikmmjj208c05qgm4.jpg"/>
       </p>
       <h3>
        寻找最优参数
       </h3>
       <p>
        你可以使用tune.svm()函数，来寻找svm()函数的最优参数。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b2945911526226473" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          ### Tuning
# Prepare training and test data
set.seed(100) # for reproducing results
rowIndices &amp;lt;- 1 : nrow(inputData) # prepare row indices
sampleSize &amp;lt;- 0.8 * length(rowIndices) # training sample size
trainingRows &amp;lt;- sample (rowIndices, sampleSize) # random sampling
trainingData &amp;lt;- inputData[trainingRows, ] # training data
testData &amp;lt;- inputData[-trainingRows, ] # test data
tuned &amp;lt;- tune.svm(response ~., data = trainingData, gamma = 10^(-6:-1), cost = 10^(1:2)) # tune
summary (tuned) # to select best gamma and cost
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b2945911526226473-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945911526226473-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945911526226473-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945911526226473-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945911526226473-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945911526226473-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945911526226473-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945911526226473-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945911526226473-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945911526226473-10">
               10
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b2945911526226473-1">
               <span class="crayon-p">
                ### Tuning
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945911526226473-2">
               <span class="crayon-p">
                # Prepare training and test data
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945911526226473-3">
               <span class="crayon-v">
                set
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                seed
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                100
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # for reproducing results
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945911526226473-4">
               <span class="crayon-v">
                rowIndices
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                nrow
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # prepare row indices
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945911526226473-5">
               <span class="crayon-v">
                sampleSize
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0.8
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                length
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                rowIndices
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # training sample size
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945911526226473-6">
               <span class="crayon-v">
                trainingRows
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                sample
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                rowIndices
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                sampleSize
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # random sampling
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945911526226473-7">
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                trainingRows
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # training data
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945911526226473-8">
               <span class="crayon-v">
                testData
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-v">
                trainingRows
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # test data
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945911526226473-9">
               <span class="crayon-v">
                tuned
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tune
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                svm
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                ~
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                gamma
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-o">
                ^
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cost
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-o">
                ^
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # tune
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945911526226473-10">
               <span class="crayon-e">
                summary
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                tuned
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # to select best gamma and cost
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0164 seconds] -->
       <p>
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b2945918921406399" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          # Parameter tuning of 'svm':
#   - sampling method: 10-fold cross validation
#
# - best parameters:
#   gamma cost
# 0.001  100
#
# - best performance: 0.26
#
# - Detailed performance results:
#   gamma cost error dispersion
# 1  1e-06   10  0.36 0.09660918
# 2  1e-05   10  0.36 0.09660918
# 3  1e-04   10  0.36 0.09660918
# 4  1e-03   10  0.36 0.09660918
# 5  1e-02   10  0.27 0.20027759
# 6  1e-01   10  0.27 0.14944341
# 7  1e-06  100  0.36 0.09660918
# 8  1e-05  100  0.36 0.09660918
# 9  1e-04  100  0.36 0.09660918
# 10 1e-03  100  0.26 0.18378732
# 11 1e-02  100  0.26 0.17763883
# 12 1e-01  100  0.26 0.15055453
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945918921406399-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945918921406399-23">
               23
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b2945918921406399-1">
               <span class="crayon-p">
                # Parameter tuning of 'svm':
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-2">
               <span class="crayon-p">
                #   - sampling method: 10-fold cross validation
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-3">
               <span class="crayon-p">
                #
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-4">
               <span class="crayon-p">
                # - best parameters:
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-5">
               <span class="crayon-p">
                #   gamma cost
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-6">
               <span class="crayon-p">
                # 0.001  100
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-7">
               <span class="crayon-p">
                #
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-8">
               <span class="crayon-p">
                # - best performance: 0.26
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-9">
               <span class="crayon-p">
                #
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-10">
               <span class="crayon-p">
                # - Detailed performance results:
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-11">
               <span class="crayon-p">
                #   gamma cost error dispersion
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-12">
               <span class="crayon-p">
                # 1  1e-06   10  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-13">
               <span class="crayon-p">
                # 2  1e-05   10  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-14">
               <span class="crayon-p">
                # 3  1e-04   10  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-15">
               <span class="crayon-p">
                # 4  1e-03   10  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-16">
               <span class="crayon-p">
                # 5  1e-02   10  0.27 0.20027759
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-17">
               <span class="crayon-p">
                # 6  1e-01   10  0.27 0.14944341
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-18">
               <span class="crayon-p">
                # 7  1e-06  100  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-19">
               <span class="crayon-p">
                # 8  1e-05  100  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-20">
               <span class="crayon-p">
                # 9  1e-04  100  0.36 0.09660918
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-21">
               <span class="crayon-p">
                # 10 1e-03  100  0.26 0.18378732
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945918921406399-22">
               <span class="crayon-p">
                # 11 1e-02  100  0.26 0.17763883
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945918921406399-23">
               <span class="crayon-p">
                # 12 1e-01  100  0.26 0.15055453
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0075 seconds] -->
       <p>
        结果证明，当cost为100，gamma为0.001时产生最小的错误率。利用这些参数训练径向支持向量机。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b294591f925363226" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          svmfit &amp;lt;- svm (response ~ ., data = trainingData, kernel = "radial", cost = 100, gamma=0.001, scale = FALSE) # radial svm, scaling turned OFF
print(svmfit)
plot(svmfit, trainingData)
compareTable &amp;lt;- table (testData$response, predict(svmfit, testData))  # comparison table
mean(testData$response != predict(svmfit, testData)) # 13.79% misclassification error
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b294591f925363226-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294591f925363226-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b294591f925363226-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294591f925363226-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b294591f925363226-5">
               5
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b294591f925363226-1">
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                svm
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                ~
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                kernel
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "radial"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cost
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                100
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                gamma
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                0.001
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                scale
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-t">
                FALSE
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # radial svm, scaling turned OFF
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294591f925363226-2">
               <span class="crayon-e">
                print
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294591f925363226-3">
               <span class="crayon-e">
                plot
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294591f925363226-4">
               <span class="crayon-v">
                compareTable
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                table
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                testData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                testData
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # comparison table
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294591f925363226-5">
               <span class="crayon-e">
                mean
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                testData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                !=
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                testData
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # 13.79% misclassification error
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0161 seconds] -->
       <p>
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b2945925692421588" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          F   M
F   6   3
M  1   19
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b2945925692421588-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b2945925692421588-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b2945925692421588-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b2945925692421588-1">
               <span class="crayon-i">
                F
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-i">
                M
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b2945925692421588-2">
               <span class="crayon-i">
                F
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                3
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b2945925692421588-3">
               <span class="crayon-i">
                M
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                19
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0009 seconds] -->
       <p>
       </p>
       <h3>
        网格图
       </h3>
       <p>
        一个2-色的网格图，能让结果看起来更清楚，它将图的区域指定为利用SVM分类器得到的结果的类别。在下边的例子中，这样的网格图中有很多数据点，并且通过数据点上的倾斜的方格来标记支持向量上的点。很明显，在这种情况下，有很多越过边界违反约束的点，但在SVM内部它们的权重都被降低了。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686b294592c008783587" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          # Grid Plot
n_points_in_grid = 60 # num grid points in a line
x_axis_range &amp;amp;lt;- range (inputData[, 2]) # range of X axis
y_axis_range &amp;amp;lt;- range (inputData[, 1]) # range of Y axis
X_grid_points &amp;amp;lt;- seq (from=x_axis_range[1], to=x_axis_range[2], length=n_points_in_grid) # grid points along x-axis
Y_grid_points &amp;amp;lt;- seq (from=y_axis_range[1], to=y_axis_range[2], length=n_points_in_grid) # grid points along y-axis
all_grid_points &amp;amp;lt;- expand.grid (X_grid_points, Y_grid_points) # generate all grid points
names (all_grid_points) &amp;amp;lt;- c("Hwt", "Bwt") # rename
all_points_predited &amp;amp;lt;- predict(svmfit, all_grid_points) # predict for all points in grid
color_array &amp;amp;lt;- c("red", "blue")[as.numeric(all_points_predited)] # colors for all points based on predictions
plot (all_grid_points, col=color_array, pch=20, cex=0.25) # plot all grid points
points (x=trainingData$Hwt, y=trainingData$Bwt, col=c("red", "blue")[as.numeric(trainingData$response)], pch=19) # plot data points
points (trainingData[svmfit$index, c (2, 1)], pch=5, cex=2) # plot support vectors
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686b294592c008783587-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-57686b294592c008783587-13">
               13
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686b294592c008783587-1">
               <span class="crayon-p">
                # Grid Plot
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-2">
               <span class="crayon-v">
                n_points_in_grid
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                60
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # num grid points in a line
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-3">
               <span class="crayon-v">
                x_axis_range
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                range
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # range of X axis
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-4">
               <span class="crayon-v">
                y_axis_range
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                range
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                inputData
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # range of Y axis
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-5">
               <span class="crayon-v">
                X_grid_points
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                seq
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                from
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                x_axis_range
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                to
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                x_axis_range
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                length
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                n_points_in_grid
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # grid points along x-axis
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-6">
               <span class="crayon-v">
                Y_grid_points
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                seq
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                from
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                y_axis_range
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                to
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                y_axis_range
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                length
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                n_points_in_grid
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # grid points along y-axis
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-7">
               <span class="crayon-v">
                all_grid_points
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                expand
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                grid
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                X_grid_points
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Y_grid_points
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # generate all grid points
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-8">
               <span class="crayon-e">
                names
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                all_grid_points
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                c
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "Hwt"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Bwt"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # rename
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-9">
               <span class="crayon-v">
                all_points_predited
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                predict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                all_grid_points
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # predict for all points in grid
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-10">
               <span class="crayon-v">
                color_array
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                amp
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                c
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "red"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "blue"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-st">
                as
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                numeric
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                all_points_predited
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # colors for all points based on predictions
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-11">
               <span class="crayon-e">
                plot
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                all_grid_points
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                col
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                color_array
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pch
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cex
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                0.25
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # plot all grid points
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686b294592c008783587-12">
               <span class="crayon-e">
                points
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                Hwt
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                y
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                Bwt
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                col
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                c
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "red"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "blue"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-st">
                as
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                numeric
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                response
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pch
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                19
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # plot data points
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686b294592c008783587-13">
               <span class="crayon-e">
                points
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                trainingData
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                svmfit
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                c
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pch
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cex
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-p">
                # plot support vectors
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0367 seconds] -->
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/03/6941baebgw1epzadi9lf5j208c06v75f.jpg"/>
       </p>
       <p>
       </p>
       <p>
        文章出处：http://it.taocms.org/03/7221.htm
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/20758.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t012aec1078cd96f01f-300x199.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20758.html" rel="bookmark" title="推荐一些从零开始学习机器学习算法的方法">
         推荐一些从零开始学习机器学习算法的方法
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20714.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t011650727f6392a3f5-300x197.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20714.html" rel="bookmark" title="寻找最优参数解：最速下降法，牛顿下降法，阻尼牛顿法，拟牛顿法DFP/BFGS">
         寻找最优参数解：最速下降法，牛顿下降法，阻尼牛顿法，拟牛顿法DFP/BFGS
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20636.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t01034a6a3b660f0c04_副本-300x203.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20636.html" rel="bookmark" title="机器学习开发者的现代化攻略：对统计学微积分Say NO！">
         机器学习开发者的现代化攻略：对统计学微积分Say NO！
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20632.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/08/t01e4f9fea2b69f4b1f-300x189.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20632.html" rel="bookmark" title="机器学习到底适合哪些人群学习？">
         机器学习到底适合哪些人群学习？
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F12490.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/12490.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/12490.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>